package com.clstu.homeworks;

public class HomeWork02 {
    public static void main(String[] args) {//执行方法看运行类型，执行特有方法向下转型
          Teacher[] arr=new Teacher[4];       //多态数组
          arr[0]=new Teacher("jack",20,"pler");
          arr[1]=new Professer("Doctor",30,"fucking");
          arr[2]=new Professer01("Anny",25,"mixker");
          arr[3]=new Fucker("Haha",18,"fucked");
        for (int i = 0; i < arr.length; i++) {
            arr[i].introduce();//多态
        }
    }
}
class Teacher{
    private String name;
    private int age;
    private String post;
    private double salary;
    public Teacher(String name, int age, String post) {
        this.name = name;
        this.age = age;
        this.post=post;
        this.salary = 9999999;
    }
    public void introduce(){
        System.out.println("I am "+post+" "+name+" , I am "+age+"years old now .");
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
}

class Professer extends Teacher{
    public Professer(String name, int age, String post) {
        super(name, age, post);
        setSalary(10000);
    }

    @Override
    public void introduce() {
        System.out.println("I am "+getPost()+" "+getName()+" , I am "+getAge()+"years old now . Salary : "+getSalary()+"okokok");
    }
}

class Professer01 extends Teacher{
    public Professer01(String name, int age, String post) {
        super(name, age, post);
        setSalary(15000);
    }
    @Override
    public void introduce() {
        System.out.println("I am "+getPost()+" "+getName()+" , I am "+getAge()+"years old now . Salary : "+getSalary()+" hahaha.");
    }
}

class Fucker extends Teacher{
    public Fucker(String name, int age, String post) {
        super(name, age, post);
        setSalary(30000);
    }
    @Override
    public void introduce() {
        System.out.println("I am "+getPost()+" "+getName()+" , I am "+getAge()+"years old now . Salary : "+getSalary()+" wuwuwu.");
    }
}